package com.xueqiu.lovepetmedicalmanagersystem.service.Impl;

import com.xueqiu.lovepetmedicalmanagersystem.mapper.EmployeeMapper;
import com.xueqiu.lovepetmedicalmanagersystem.pojo.Employee;
import com.xueqiu.lovepetmedicalmanagersystem.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author xueqiu
 */
@Service
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    private EmployeeMapper employeeMapper;

    /**
     * 查询单个员工
     * 对于多个参数来说，每个参数之前都要加上@Param注解，要不然会找不到对应的参数进而报错
     * @param name 员工姓名
     * @param password 员工密码
     * @return 员工对象；可能找不到为NULL
     */
    @Override
    public Employee queryEmployeeByNameAndPwd(String name, String password) {
        return employeeMapper.queryEmployeeByNameAndPwd(name, password);
    }

    /**
     * 新增单个员工
     * @param employee 新增数据源
     * @return 新增个数，成功=1，失败=0
     */
    @Override
    public Integer insertEmployee(Employee employee) {
        return employeeMapper.insertEmployee(employee);
    }
}
